import time

from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By


class DingDan():

    zhanghu=(By.CSS_SELECTOR,'a[href*="user.php"]')
    dingdan=(By.PARTIAL_LINK_TEXT,'我的订单')


    def dan(self,wd):

        time.sleep(1)
        wd.find_element_by_css_selector('input[name*="username"]').send_keys("123456")
        time.sleep(1)
        wd.find_element_by_css_selector('input[name*="password"]').send_keys('1373331kkkkAA')
        time.sleep(1)
        wd.find_element_by_css_selector('input[name*="submit"]').click()
        wd.find_element(*self.zhanghu).click()

        time.sleep(2)
        wd.find_element(*self.dingdan).click()

if __name__ == '__main__':
    wd = webdriver.WebDriver()
    wd.get("http://192.168.88.132/user.php")
    wd.implicitly_wait(10)
    d=DingDan()
    d.dan(wd)
    print(wd.window_handles)